//## 수신자 추가
function fnSetRcvr(userObj)
{
	if (userObj.value != "")
	{
		var userText = document.frmWorkBbs.bbsMem.options[document.frmWorkBbs.bbsMem.selectedIndex].text+",";
		var userValue = userObj.value+",";
		document.frmWorkBbs.rcvr.value = document.frmWorkBbs.rcvr.value.replace(userValue,"") + userValue;			
		document.frmWorkBbs.rcvrs.value = document.frmWorkBbs.rcvrs.value.replace(userText,"") + userText;			
	}
}

//## 수신자 제외
function fnRmvRcvr(mode)
{
	if (mode == "all")
	{
		document.frmWorkBbs.rcvr.value = "";
		document.frmWorkBbs.rcvrs.value = "";
	}
	else
	{
		if (document.frmWorkBbs.bbsMem.value != "")
		{
			var userText = document.frmWorkBbs.bbsMem.options[document.frmWorkBbs.bbsMem.selectedIndex].text+",";
			var userValue = document.frmWorkBbs.bbsMem.value+",";
			document.frmWorkBbs.rcvr.value = document.frmWorkBbs.rcvr.value.replace(userValue,"");			
			document.frmWorkBbs.rcvrs.value = document.frmWorkBbs.rcvrs.value.replace(userText,"");			
		}
	}
}

//## 문서 저장하기
function fnSave(){
	if(document.frmWorkBbs.subjects.value==""){
		alert("제목를 입력해 주세요.");
		document.frmWorkBbs.subjects.focus();
		return false;
	}
	if(document.frmWorkBbs.rcvrs.value==""){
		alert("수신자를 선택해 주세요.");
		document.frmWorkBbs.bbsMem.focus();
		return;
	}
	if(document.frmWorkBbs.endDt.value==""){
		alert("마감일을 선택해 주세요.");
		document.frmWorkBbs.endDt.focus();
		return;
	}
	
	var oEditor = FCKeditorAPI.GetInstance('context') ;
	var contents = oEditor.GetXHTML(true);

	if (contents == "" || contents == null || contents == '&nbsp;' || contents == '<p>&nbsp;<p>'){
		alert("내용을 입력하세요.");
		oEditor.Focus();
		return false;
	}
	try
	{
		fnSaving('on');
		document.frmWorkBbs.submit();
	}
	catch (e){
		fnSaving('off');
	}
}

function fnSaving(flag)
{
	if (flag == "on")
	{
		$("#showSaving").css("display","");
		$("#showSaving").html("저장 중 ....");
		$("#btnSave").css("display","none");
	}
	else
	{
		$("#showSaving").css("display","none");
		$("#showSaving").html("");
		$("#btnSave").css("display","");	
	}
}

function fnReset()
{
	location.href="?workSeq=<%=workSeq%>";
}